%time per iteration for different values of n, given d
function plottime4_n(dir,m,d)
prefs=strvcat('pref1','pref5','pref9','pref2','pref4','pref6','pref8','pref10');
files=strvcat('2-10','12','14','16','18','20');
numfiles = length(files(:,1));
numprefs = length(prefs(:,1));
domaincol=3;
resultcol=18;
domain=0;
average=0;
stddev=0;
for p=1:numprefs
  count=0;
  for i=1:numfiles
    %load a file
      alldata=load(strcat(dir,'\m',int2str(m),'_n',files(i,:),'_d',int2str(d),'_',prefs(p,:),'.all.results'));
    numblocks=alldata(length(alldata)-1,2)+1;
    iterationsPerRun = (numblocks-1)*100; % first block does not count
    totexp=length(alldata)/numblocks;
    for j=1:totexp;
        count=count+1;
        domain(p,count)=alldata(j*numblocks,domaincol);
        average(p,count)= alldata(j*numblocks,resultcol)/iterationsPerRun;
        stddev(p,count)= alldata(j*numblocks,resultcol+1)/iterationsPerRun;
    end;
  end;
end;

%domain
%average
%stddev

%a1 = x0:(x1-x0)/10:x1;


%for a1=.4
%g=1.5
lw=2;
fs=24;
clf;
set(gca,'FontSize',fs);
%set(gca,'XTick',[1000,2000,3000,4000,5000]);
%set(gca,'XTickLabel',{'1k','2k','3k','4k','5k'});
colors='kbgrcmykbgrcmy';
%colors='kkkgggcc';
markers='+o*.xsdv^><ph';
%plot(domain,average,'LineWidth',lw);
for i=1:numprefs
    errorbar(domain(i,:),average(i,:),stddev(i,:),'LineWidth',lw,'Color',colors(i),'Marker',markers(i));
    hold on;
end;
legend1 = legend(prefs,'Location','NorthWest');
set(legend1,'Box','off');

%ylim([0 200]);
xlim([2 20]);
xlabel('number of bidders (n)', 'FontSize', fs);
ylabel('time per iteration (ms)', 'FontSize', fs);
%title('Percentage of all runs that converge to a given error');
hold off;


name = strcat('./time4_d',int2str(d));
print('-depsc',strcat(name, '.eps'));
%print('-dpdf',strcat(name, '.pdf'));
end

